package com.qp.basics.estivate.support;

import com.qp.basics.estivate.ResultSetExtractor;
import com.qp.basics.estivate.jdbc.dao.BasicRowProcessor;

import java.sql.ResultSet;
import java.sql.SQLException;

public class SimpleBeanResultSetExtractor implements ResultSetExtractor {
	Class clazz;

	public SimpleBeanResultSetExtractor() {
	}

	public SimpleBeanResultSetExtractor(Class clazz) {
		this.clazz = clazz;
	}

	public Object extractData(ResultSet resultset) throws SQLException {
		return BasicRowProcessor.instance().toBean(resultset, clazz);
	}

	public Class getClazz() {
		return clazz;
	}

	public void setClazz(Class clazz) {
		this.clazz = clazz;
	}
}
